import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

let local_lang;
if(localStorage.getItem('lang')){
  local_lang = localStorage.getItem('lang');
}

export default new Vuex.Store({
  state: {
    userName: '',
    developerId: '',
    account: '',
    localLang: local_lang || 'US'
  },
  mutations: {
    updateUserName (state, payload) {
      state.userName = payload
    },
    updateDeveloperId (state, payload) {
      state.developerId = payload
    },
    updateAccount (state, payload) {
      state.account = payload
    },
    updateLang (state, payload) {
      state.localLang = payload
    },
  }
})
